import React from "react"
import {getdetail} from "./api"
import qs from 'query-string'
import "./list.css"
class Song1 extends React.Component{
    constructor(){
        super()
        this.state={
            data:[]
        }
    }
    shang(){
        this.props.history.go(-1)
    }
    componentDidMount(){
        let id = qs.parse(this.props.location.search).id
        getdetail(id)
        .then(res=>{
            console.log(res)
            this.setState({
                data:res.playlist
            })
        })
    }
    render(){
        let {data} = this.state
        return(
            <div id="list">
                <h3 onClick={this.shang.bind(this)}>
                <img src={require('../../imgs/back.png')}/>
                    返回</h3>
                <img src={data.coverImgUrl} style={{width:"400px",height:"400px"}}/>
                <h2 style={{fontWeight:"100",color:"hotpink"}}>{data.description}</h2>
            </div>
        )
    }
}

export default Song1